const {
  DataTypes
} = require('sequelize');

module.exports = sequelize => {
  const attributes = {
    id: {
      type: DataTypes.INTEGER,
      allowNull: false,

      primaryKey: true,
      autoIncrement: true,
      comment: "ID",
      field: "id"
    },
    name: {
      type: DataTypes.STRING(50),
      allowNull: false,
      defaultValue: '',
      primaryKey: false,
      autoIncrement: false,
      comment: "药品名称",
      field: "name"
    },
    en_name: {
      type: DataTypes.STRING(50),
      allowNull: false,
      defaultValue: '',
      primaryKey: false,
      autoIncrement: false,
      comment: "生产厂商名称",
      field: "en_name"
    },
    en_code: {
      type: DataTypes.STRING(50),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "厂商识别码",
      field: "en_code"
    },
    permission: {
      type: DataTypes.STRING(50),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "生产许可编号",
      field: "permission"
    },
    date: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue:  0,
      primaryKey: false,
      autoIncrement: false,
      comment: "生产日期",
      field: "date"
    },
    out_date: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: 0,
      primaryKey: false,
      autoIncrement: false,
      comment: "保质期",
      field: "out_date"
    },
    num_buy: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: 0,
      primaryKey: false,
      autoIncrement: false,
      comment: "购买量",
      field: "num_buy"
    },
    date_buy: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: 0,
      primaryKey: false,
      autoIncrement: false,
      comment: "购买日期",
      field: "date_buy"
    },
    person_incharge: {
      type: DataTypes.STRING(50),
      allowNull: false,
      defaultValue: 0,
      primaryKey: false,
      autoIncrement: false,
      comment: "负责人",
      field: "person_incharge"
    },
    picture: {
      type: DataTypes.STRING(60),
      allowNull: false,
      defaultValue: 0,
      primaryKey: false,
      autoIncrement: false,
      comment: "药物照片",
      field: "picture"
    },
    createdAt: {
      type: DataTypes.DATE,
      allowNull: true,

      primaryKey: false,
      autoIncrement: false,
      comment: null,
      field: "createdAt"
    },
    updatedAt: {
      type: DataTypes.DATE,
      allowNull: true,

      primaryKey: false,
      autoIncrement: false,
      comment: null,
      field: "updatedAt"
    },
    deletedAt: {
      type: DataTypes.DATE,
      allowNull: true,

      primaryKey: false,
      autoIncrement: false,
      comment: null,
      field: "deletedAt"
    }
  };
  const options = {
    tableName: "drugs_baseinfo",
    comment: "",
    indexes: [],
    timestamps: true,
    paranoid: true
  };
  const DrugsBaseinfoModel = sequelize.define("drugs_baseinfo_model", attributes, options);
  return DrugsBaseinfoModel;
};